Don't let the child draw over the focus rectangle.
authorMatthias Clasen <mclasen@redhat.com>
Fri, 7 May 2004 15:26:35 +0000 (15:26 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 7 May 2004 15:26:35 +0000 (15:26 +0000)
2004-05-07  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkbutton.c (gtk_button_size_allocate): Don't let the child
draw over the focus rectangle.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkbutton.c

index 3feb3feba3bdbdb3912ef1567e567fd6c513a893..ed8392448a41d46395e661d9c5283e4d8b7cb9df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-05-07  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkbutton.c (gtk_button_size_allocate): Don't let the child
+       draw over the focus rectangle.
+
        * gtk/gtkhsv.c: Draw focus indication in the color wheel using
        standard focus style.  (#63071, Bill Haneman, idea for new
        style by Owen Taylor)
index 3feb3feba3bdbdb3912ef1567e567fd6c513a893..ed8392448a41d46395e661d9c5283e4d8b7cb9df 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-07  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkbutton.c (gtk_button_size_allocate): Don't let the child
+       draw over the focus rectangle.
+
        * gtk/gtkhsv.c: Draw focus indication in the color wheel using
        standard focus style.  (#63071, Bill Haneman, idea for new
        style by Owen Taylor)
index 3feb3feba3bdbdb3912ef1567e567fd6c513a893..ed8392448a41d46395e661d9c5283e4d8b7cb9df 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-07  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkbutton.c (gtk_button_size_allocate): Don't let the child
+       draw over the focus rectangle.
+
        * gtk/gtkhsv.c: Draw focus indication in the color wheel using
        standard focus style.  (#63071, Bill Haneman, idea for new
        style by Owen Taylor)
index 3feb3feba3bdbdb3912ef1567e567fd6c513a893..ed8392448a41d46395e661d9c5283e4d8b7cb9df 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-07  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkbutton.c (gtk_button_size_allocate): Don't let the child
+       draw over the focus rectangle.
+
        * gtk/gtkhsv.c: Draw focus indication in the color wheel using
        standard focus style.  (#63071, Bill Haneman, idea for new
        style by Owen Taylor)
index d1c7c16104d3cbcde9bfe15fd0a7ee0479b09902..f60fb6820ba0b8e0a33b7f4ad964574cbfee7ed3 100644 (file)
@@ -930,8 +930,15 @@ gtk_button_size_allocate (GtkWidget     *widget,
   gint xthickness = GTK_WIDGET (widget)->style->xthickness;
   gint ythickness = GTK_WIDGET (widget)->style->ythickness;
   GtkBorder default_border;
+  gint focus_width;
+  gint focus_pad;
 
   gtk_button_get_props (button, &default_border, NULL, NULL);
+  gtk_widget_style_get (GTK_WIDGET (widget),
+                       "focus-line-width", &focus_width,
+                       "focus-padding", &focus_pad,
+                       NULL);
                            
   widget->allocation = *allocation;
 
@@ -960,6 +967,11 @@ gtk_button_size_allocate (GtkWidget     *widget,
          child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
        }
 
+      child_allocation.x += focus_width + focus_pad;
+      child_allocation.y += focus_width + focus_pad;
+      child_allocation.width =  MAX (1, child_allocation.width - (focus_width + focus_pad) * 2);
+      child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2);
+
       if (button->depressed)
        {
          gint child_displacement_x;